import React, { lazy } from "react";
import { Routes, Route,Navigate } from 'react-router-dom';
import Home from "@/pages/home";
import Recommend from "@/pages/home/recommend";
// 使用lazy 对非首pin进行懒加载
const Community=lazy(()=>import('@/pages/Community'));
const Sport=lazy(()=>import('@/pages/Sport'));
const Shop=lazy(()=>import('@/pages/Shop'));
const User=lazy(()=>import('@/pages/User'))
const Search=lazy(()=>import('@/pages/Search'))
const Member=lazy(()=>import('@/pages/home/member'))
const Activity=lazy(()=>import('@/pages/home/activity'))
const Festival=lazy(()=>import('@/pages/home/festival'))
export default () => {
    return (
        <>
            <Routes>
                {/* 使用Navigate 重定向 */}
                <Route path="/" element={<Navigate to={'/home'}/>}> </Route>
                <Route path="/home" element={<Home/>}>
                    <Route path="/home" element={<Navigate to={'/home/recommend'}/>}></Route>
                    <Route path="/home/recommend" element={<Recommend/>}></Route>
                    <Route path="/home/member" element={<Member/>}></Route>
                    <Route path="/home/activity" element={<Activity/>}></Route>
                    <Route path="/home/festival" element={<Festival/>}></Route>
                </Route>
                <Route path="/community" element={<Community/>}></Route>
                <Route path="/sport" element={<Sport/>}></Route>
                <Route path="/shop" element={<Shop/>}></Route>
                <Route path="/user" element={<User/>}></Route>
                <Route path="/search" element={<Search/>}></Route>
            </Routes>
        </>

    )
}